home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / clarion / 3rdparty / tools / toolcrft / pbrowse.tpw < prev    next >
Encoding:
Text File  |  1995-10-23  |  11.6 KB  |  289 lines

  1. #!---------------------------------------------------------!
  2. #!                                                         !
  3. #! Copyright 1994, 1995 ToolCraft Development Corporation  !
  4. #!                                                         !
  5. #!                  ALL RIGHTS RESERVED                    !
  6. #!                                                         !
  7. #!---------------------------------------------------------!
  8. #!
  9. #!
  10. #!-------------------------------------------------------------------------
  11. #PROCEDURE(PowerBrowse,'Power Browse a Page-Loaded List Box'),HLP('~PBProcedureProperties'),WINDOW,QUICK(PowerBrowseWizard(Wizards))
  12. #LOCALDATA
  13. OriginalRequest          LONG,AUTO
  14. LocalRequest             LONG,AUTO
  15. LocalResponse            LONG,AUTO
  16. WindowOpened             LONG
  17. WindowInitialized        LONG
  18. ForceRefresh             LONG,AUTO
  19. #ENDLOCALDATA
  20. #CLASS('Procedure Setup','Upon Entry into the Procedure')
  21. #CLASS('Before Lookups','Refresh Window ROUTINE, before lookups')
  22. #CLASS('After Lookups','Refresh Window ROUTINE, after lookups')
  23. #CLASS('Procedure Exit','Before Leaving the Procedure')
  24. #PROMPT('&Parameters:',@s80),%Parameters
  25. #BOXED('Window Settings')
  26.   #PROMPT('Window Operation Mode:',DROP('Use WINDOW setting|Normal|MDI|Modal')),%WindowOperationMode
  27.   #PROMPT('Maximize the Window on Open',CHECK),%AlwaysMaximizeOnOpen,AT(10,,115)
  28.   #PROMPT('Specify the Field to Select on Open',CHECK),%SpecifyFirstField,AT(10,,130)
  29.   #ENABLE(%SpecifyFirstField)
  30.     #PROMPT('Field to Select:',CONTROL),%FirstFieldToSelect
  31.     #VALIDATE(%FirstFieldToSelect,'You Must Specify the Field to Select')
  32.   #ENDENABLE
  33. #ENDBOXED
  34. #ENABLE(%INIActive)
  35.   #BOXED('INI File Settings')
  36.     #PROMPT('Save and Restore Window Location',CHECK),%INISaveWindow,DEFAULT(1),AT(10,,130)
  37.   #ENDBOXED
  38. #ENDENABLE
  39. #BOXED('Resize Options')
  40.   #PROMPT('Enable Window Resizing',CHECK),%EnableWindowResize,AT(10,,95)
  41.   #ENABLE(%EnableWindowResize)
  42.     #PROMPT('Parent List Box:',FROM(%Control,%ControlTemplate = 'BrowseBox(ToolCraft)')),%ResizeListBox
  43.     #VALIDATE(%ResizeListBox,'You must pick a parent list box for resizing.')
  44.     #ENABLE(%ResizeListBox)
  45.       #PREPARE
  46.         #IF(%SecondaryResizeListBox = %ResizeListBox)
  47.           #CLEAR(%SecondaryResizeListBox)
  48.         #ENDIF
  49.       #ENDPREPARE
  50.       #PROMPT('Enable Secondary Window Resizing',CHECK),%EnableSecondaryResize,AT(10,,130)
  51.       #ENABLE(%EnableSecondaryResize)
  52.         #PROMPT('Child List Box:',FROM(%Control,%ControlTemplate = 'BrowseBox(ToolCraft)' AND %Control <> %ResizeListBox)),%SecondaryResizeListBox
  53.         #VALIDATE(%SecondaryResizeListBox,'You must pick a child list box for resizing.')
  54.       #ENDENABLE
  55.     #ENDENABLE
  56.   #ENDENABLE
  57. #ENDBOXED
  58. #EMBED(%GatherSymbols,'Gather Template Symbols'),HIDE
  59. #DECLARE(%FirstField)
  60. #DECLARE(%LastField)
  61. #INSERT(%FieldTemplateStandardButtonMenuPrompt)
  62. #INSERT(%FieldTemplateStandardEntryPrompt)
  63. #INSERT(%FieldTemplateStandardCheckBoxPrompt)
  64. #INSERT(%WindowResizeSetup)
  65. #MESSAGE('',3)
  66. #DECLARE(%CmtPos)
  67. #SET(%CmtPos,65)
  68. #COMMENT(%CmtPos)
  69. #ATSTART
  70. #!  #FREE(%ToolCraftIconList)
  71. #ENDAT
  72. #AT(%CustomGlobalDeclarations)
  73.   #INSERT(%StandardGlobalSetup(Clarion))
  74. #ENDAT
  75.  
  76.  
  77.  
  78.  
  79. #IF(%Parameters)
  80. %[20]Procedure PROCEDURE%Parameters
  81. #ELSE
  82. %[20]Procedure PROCEDURE
  83. #ENDIF
  84.  
  85. !--------------------------------------------------------------------------------------------------!
  86. ! Declarations                                                                                     !
  87. !--------------------------------------------------------------------------------------------------!
  88. #FOR(%LocalData)
  89. %[20]LocalData %LocalDataStatement
  90. #ENDFOR
  91. #INSERT(%StandardWindowGeneration)
  92.  
  93. !--------------------------------------------------------------------------------------------------!
  94. ! Code Section                                                                                     !
  95. !--------------------------------------------------------------------------------------------------!
  96.   CODE
  97.  
  98.   #EMBED(%ProcedureSetup,'Procedure Setup')
  99.   #INSERT(%StandardFormula,'Procedure Setup')
  100.   LocalRequest = GlobalRequest
  101.   OriginalRequest = LocalRequest
  102.   LocalResponse = RequestCancelled
  103.   ForceRefresh = False
  104.   CLEAR(GlobalRequest)
  105.   CLEAR(GlobalResponse)
  106.  
  107.   #INSERT(%FileControlOpen)
  108.  
  109.   #EMBED(%BeforeWindowOpening,'Before Opening the Window')
  110.   OPEN(%Window)
  111.   WindowOpened = True
  112.   #IF(%INIActive AND %INISaveWindow)
  113.   INIRestoreWindow('%Procedure','%INIFileName')
  114.   #ENDIF
  115.   #EMBED(%AfterWindowOpening,'After Opening the Window')
  116.   #IF(%SpecifyFirstField AND %FirstFieldToSelect)
  117.   SELECT(%FirstFieldToSelect)
  118.   #ELSE
  119.     #CLEAR(%FirstFieldToSelect)
  120.     #FOR(%Control),WHERE(%ControlType <> 'SHEET' AND %ControlType <> 'TAB' AND %ControlTemplate <> 'AlternateListFormat(ToolCraft)')
  121.   SELECT(%Control)
  122.       #BREAK
  123.     #ENDFOR
  124.   #ENDIF
  125.   #IF(%AlwaysMaximizeOnOpen)
  126.   IF NOT %Window{PROP:Maximize}                     #<!If Window Not Already Maximize
  127.     %Window{PROP:Maximize} = True                   #<!  Always Maximize Window when First Opened
  128.   END                                               #<!End If
  129.   #ENDIF
  130.  
  131.   #EMBED(%BeforeAccept,'Preparing to Process the Window')
  132.  
  133.   ACCEPT                                            #<!Begin Processing Event Loop
  134.                                                     #<!
  135.     #EMBED(%AcceptLoopBeforeEventHandling,'Accept Loop, Before CASE EVENT() handling')
  136.     CASE EVENT()                                    #<!Process Events for the Window
  137.     #INSERT(%StandardWindowHandling)
  138.     END                                             #<!End Events for Window
  139.     #EMBED(%AcceptLoopAfterEventHandling,'Accept Loop, After CASE EVENT() handling')
  140.  
  141.     #EMBED(%AcceptLoopBeforeFieldHandling,'Accept Loop, Before CASE FIELD() handling')
  142.     CASE FIELD()                                    #<!Process Events for Controls
  143.     #INSERT(%StandardControlHandling)
  144.     END                                             #<!End Events for Controls
  145.     #EMBED(%AcceptLoopAfterFieldHandling,'Accept Loop, After CASE FIELD() handling')
  146.   END                                               #<!End Event Loop
  147.                                                     #<!
  148.   DO ProcedureReturn                                #<!Cleanup and Exit the Procedure
  149.  
  150.  
  151. !--------------------------------------------------------------------------------------------------!
  152. ! InitializeWindow Routine                                                                         !
  153. !                                                                                                  !
  154. ! Initialize and Display window for the first time.                                                !
  155. !--------------------------------------------------------------------------------------------------!
  156. InitializeWindow   ROUTINE
  157.   #EMBED(%WindowInitializationCode,'Window Initialization Code')
  158.   DO RefreshWindow
  159.  
  160.  
  161. !--------------------------------------------------------------------------------------------------!
  162. ! RefreshWindow Routine                                                                            !
  163. !                                                                                                  !
  164. ! Redisplays the fields for the window.                                                            !
  165. !--------------------------------------------------------------------------------------------------!
  166. RefreshWindow      ROUTINE
  167.  
  168.   IF %Window{Prop:AcceptAll} THEN EXIT.
  169.   #EMBED(%RefreshWindowBeforeDisplay,'Refresh Window routine, before DISPLAY()')
  170.   DISPLAY()
  171.   ForceRefresh = False
  172.  
  173.  
  174. #EMBED(%ProcedureRoutines,'Procedure Routines')
  175. !--------------------------------------------------------------------------------------------------!
  176. ! ProcedureReturn Routine                                                                                   !
  177. !                                                                                                  !
  178. ! End of procedure cleanup and exit.                                                               !
  179. !--------------------------------------------------------------------------------------------------!
  180. ProcedureReturn    ROUTINE
  181.  
  182.   #INSERT(%FileControlClose)
  183.  
  184.   #INSERT(%StandardWindowClosing)
  185.  
  186.   #EMBED(%EndOfProcedure,'End of Procedure')
  187.   #INSERT(%StandardFormula,'Procedure Exit')
  188.  
  189.   GlobalResponse = LocalResponse
  190.   RETURN
  191.  
  192.  
  193. #EMBED(%LocalProcedures,'Local Procedures'),HIDE
  194. #!------------------------------------------------------------------------
  195. #AT(%DataSectionBeforeWindow)
  196. #INSERT(%PowerBrowseDeclarations)
  197. #ENDAT
  198. #!------------------------------------------------------------------------
  199. #AT(%AfterWindowOpening)
  200. #IF(%EnableWindowResize)
  201. #INSERT(%GenerateResizeOpenWindowHandling)
  202. #ENDIF
  203. #INSERT(%GenerateHideListBoxControls)
  204. #INSERT(%GenerateIconListAssignments)
  205. #ENDAT
  206. #!------------------------------------------------------------------------
  207. #AT(%AcceptLoopBeforeEventHandling),WHERE(%EnableWindowResize)
  208. IF SELECTED() THEN CurrentSelected = SELECTED().    #<!Save Current Field Selection
  209. #ENDAT
  210. #!-------------------------------------------------------------------------
  211. #AT(%WindowOtherEventHandling),WHERE(%EnableWindowResize)
  212. #INSERT(%GenerateResizeEventHandling)
  213. #ENDAT
  214. #!------------------------------------------------------------------------
  215. #AT(%ProcedureRoutines),WHERE(%EnableWindowResize)
  216. #INSERT(%GenerateResizeWindowRoutine)
  217. #ENDAT
  218. #!------------------------------------------------------------------------
  219. #COMMENT(%CmtPos)
  220. #DEFAULT
  221. NAME PwrDefaultBrowse
  222. [COMMON]
  223. DESCRIPTION 'Browse with update and select'
  224. FROM ToolCraft PowerBrowse
  225. [PROMPTS]
  226. %WindowOperationMode STRING('Use WINDOW setting')
  227. %INISaveWindow LONG (1)
  228. [ADDITION]
  229. NAME ToolCraft BrowseBox
  230. [INSTANCE]
  231. INSTANCE 1
  232. [PROMPTS]
  233. %LocatorType STRING ('Step')
  234. %LocatorControl STRING ('')
  235. %FillLocatorField @S180 ('')
  236. %HotDisplay LONG (0)
  237. %UsingMultiDisplay LONG (0)
  238. %AltFormats MULTI LONG ()
  239. %OrderDescription DEPEND %AltFormats @S60 TIMES 0
  240. %OrderKey DEPEND %AltFormats KEY TIMES 0
  241. %AltFormat DEPEND %AltFormats STRING TIMES 0
  242. %AltRecordFilter DEPEND %AltFormats @S180 TIMES 0
  243. %AltRangeField DEPEND %AltFormats COMPONENT TIMES 0
  244. %AltRangeLimitType DEPEND %AltFormats STRING TIMES 0
  245. %AltRangeLimit DEPEND %AltFormats @s100 TIMES 0
  246. %AltRangeLow DEPEND %AltFormats @S100 TIMES 0
  247. %AltRangeHigh DEPEND %AltFormats @S100 TIMES 0
  248. %AltRangeFile DEPEND %AltFormats FILE TIMES 0
  249. %ChangeOrderControl STRING ('')
  250. %RecordFilter @S180 ('')
  251. %RangeField COMPONENT()
  252. %RangeLimitType STRING ('Current Value')
  253. %RangeLimit @s100 ('')
  254. %RangeLow @S100 ('')
  255. %RangeHigh @S100 ('')
  256. %RangeFile FILE ()
  257. %UpdateProcedure PROCEDURE ()
  258. %ParentListControl STRING ('')
  259.  
  260. [ADDITION]
  261. NAME ToolCraft SelectButton
  262. [INSTANCE]
  263. INSTANCE 3
  264. PARENT 1
  265. [PROMPTS]
  266. %HideIfDisabled LONG (1)
  267. [ADDITION]
  268. NAME ToolCraft UpdateButtons
  269. [INSTANCE]
  270. INSTANCE 2
  271. PARENT 1
  272. [PROMPTS]
  273. %UpdateProcedure PROCEDURE ()
  274. [ADDITION]
  275. NAME Clarion CloseButton
  276. [INSTANCE]
  277. INSTANCE 4
  278. [WINDOW]
  279. Screen  WINDOW('Browse Records'),AT(0,0,247,140),STATUS,SYSTEM,GRAY,MDI
  280.           LIST,AT(5,5,235,100),MSG('Browsing Records'),ALRT(CtrlEnter),ALRT(InsertKey),ALRT(DeleteKey),USE(?List),IMM,FROM(BRWQ),#SEQ(1),#ORIG(BrowseBox)
  281.           BUTTON('Close'),AT(200,110,40,10),USE(?Close),#SEQ(4),#ORIG(?Close)
  282.           BUTTON('Select'),AT(145,110,40,10),KEY(EnterKey),USE(?Select),#SEQ(3),#ORIG(?Select)
  283.           BUTTON('Insert'),AT(5,110,40,10),USE(?Insert),#SEQ(2),#ORIG(?Insert),#LINK(?Change)
  284.           BUTTON('Change'),AT(50,110,40,10),USE(?Change),#SEQ(2),#ORIG(?Change),#LINK(?Delete)
  285.           BUTTON('Delete'),AT(95,110,40,10),USE(?Delete),#SEQ(2),#ORIG(?Delete),#LINK(?Insert)
  286.         END
  287.  
  288. #ENDDEFAULT
  289.